package com.evenmo.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.evenmo.pojo.BigData;
import com.evenmo.pojo.LayUIResultMap;
import com.evenmo.service.BigDataService;
@RequestMapping(value="/bigdata")
@Controller
public class BigDataController {
	@Autowired
private BigDataService bigDataService;
	@RequestMapping(value="/datas",method=RequestMethod.GET)
	@ResponseBody
	public LayUIResultMap<BigData> selectBigdatas(@RequestParam(value="page",defaultValue="1",required=false)Integer pageNum,
			@RequestParam(value="limit",required=false,defaultValue="10")Integer pageSize,@RequestParam(value="search",defaultValue="",required=false)String search
			) {
		
		Map<String,Object> map= new HashMap<String,Object>();
		map.put("pageNum", pageNum);
		map.put("pageSize", pageSize);
		map.put("search", search);
		Map<String,Object> result =new HashMap<String,Object>();
		
LayUIResultMap<BigData> queryDatasBy = bigDataService.queryDatasBy(map);
		
if(queryDatasBy.getData().isEmpty()) {
			queryDatasBy.setCode(1);
			queryDatasBy.setMsg("未找到数据");
		}else {
			queryDatasBy.setCode(0);
			queryDatasBy.setMsg("查询成功！");
			System.out.println(queryDatasBy.getData());
			
		}
		return queryDatasBy;
	}
}
